import Vue from "vue";
import ElementUI from "element-ui";

import "@/styles/index.scss"; // global css

import App from "./App";
import store from "./store";
import router from "./router";

import setMenu from "@/permission"; // permission control
setMenu(); //动态菜单栏数据处理

//echarts 懒加载
// import "components/echarts";

// 全局注入自己封装的组件
import globalComp from "components";
Vue.use(globalComp);

//加载loading
import { openLoading } from "@/common/js/loading.js";
Vue.prototype.openLoading = openLoading;

//提示信息
import DonMessage from "@/common/js/message.js";
Vue.prototype.message = new DonMessage(); //消息提示

//全局通用的工具函数
import * as utils from "@/utils/index";
Vue.prototype.utils = utils;

//格式化表格头、筛选列和详情列
import ConfigCondition from "@/utils/configCondition";
Vue.prototype.ConfigCondition = ConfigCondition;

import Bus from "vue";
Vue.prototype.bus = new Bus();

//全局的文字配置
import { config } from "./config";
Vue.prototype.config = config;

let { NODE_ENV } = process.env;
import OmegaTracker from "@didi/omega-tracker";
window.Omega = OmegaTracker.getTracker({
  appKey: NODE_ENV == "cn" ? "omega4ad79186d4" : "omega88888ccb52",
  autoClick: false, // 全局点击事件监控，如不需要 建议关闭
  autoPosition: false, //一般 pc web 建议关闭自动定位
  /**
   * 开启停留时长
   * ps: omega平台不支持查看数据，需直接查表 https://datamap.didichuxing.com/detail?uri=hive://mycluster-tj:omega:dwd_pub_web_pagetime_hi
   * @doc http://wiki.intra.xiaojukeji.com/pages/viewpage.action?pageId=840521429
   * @date 20220708
   * @by mathewlijiang
   */
  openStayTime: true,
});

//国际化
Vue.use(ElementUI, { size: "small" });

Vue.config.productionTip = false;

new Vue({
  el: "#app",
  router,
  store,
  render: (h) => h(App),
});
